<!doctype html>
<html>
<head>
	<title>Kinnitatud pakkumised</title>
</head>
<body>
<h1>Teenindamise alustamine</h1>

<?php
  $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_ulpst_p");
  $kask=$yhendus->prepare("SELECT
  id ,kliendisoov from mikrobussivedu
  WHERE pakkuminekinnitatud=1 AND teeninduseseisnund=0");
  $kask->bind_result($id, $kliendisoov);
  $kask->execute();
  
  echo"<table border='1'>
  <tr>
	<th>ID</th>
	<th>kliendisoov</th>
  </tr>";
  
	while($kask->fetch()){
		echo"<tr>
		<td>$id</td>
		<td>$kliendisoov</td>
		<td><a href='?kinnita=$id'>Alusta teenindamist</a></td>
		</tr>";
	}
	echo"</table>";
	
	if(isset($_REQUEST["kinnita"])){
  $kask=$yhendus->prepare("UPDATE mikrobussivedu SET teeninduseseisnund=1 WHERE id=?");
  $kask->bind_param("i",$_REQUEST["kinnita"]);
  $kask->execute();
  $yhendus->close();
  header("Location: $_SERVER[PHP_SELF]");
  
  exit();
  }
	
 ?>
 </br>
 Tabel on tühi juhul kui pole teenindamata kinnitatud pakkumisi...
 </body>